package com.pentofab.payrollmanagement.ui.controller;

import java.net.URL;
import java.util.ResourceBundle;

import com.pentofab.payrollmanagement.application.PayrollApplicationFactory;
import com.pentofab.payrollmanagement.dao.model.Company;
import com.pentofab.payrollmanagement.dao.model.UserAccounts;

import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.control.ListView;

public class CompanyLeaveTabController  extends AbstractUIController {

	@FXML
	Parent root;
	@FXML
	private ListView<String> leaveModuleList;
	private Company company;
	private UserAccounts userAccounts;

	@Override
	public Parent getView() {
		return root;
	}

	@Override
	public String getTitle() {

		return "Attendance View";
	}

	@Override
	public void refreshUI(Object... args) {
		
		if (args != null && args.length > 0) {
			Company company = (Company) args[0];
			this.company = company;
			
			if(args.length > 1 && args[1] instanceof UserAccounts){
				userAccounts = (UserAccounts) args[1];
			}
		}

	}
	
	public void goBack() {

		PayrollApplicationFactory.getMainController().showScreen(
				MainController.COMPANIES_LIST_SCREEN, false, userAccounts);
	}
	
	public void open() {
		System.out.println("Open");
		PayrollApplicationFactory.getMainController().showScreen("Leave.fxml", true, company,userAccounts);
	}

	
	@Override
	public void initialize(URL fxmlFileLocation, ResourceBundle resources) {
		
		leaveModuleList.getItems().add("Apply For Leave");
//		leaveModuleList.getItems().add("Cancel Leave");

	}
}
